Learn R Programming

BDgraph (version 2.74)

Discrete Weibull: The Discrete Weibull Distribution (Type 1)

Description

Density, distribution function, quantile function and random generation for the discrete Weibull distribution (type I) with parameters \(q\) and \(\beta\).

Usage

ddweibull(x, q = exp(-1), beta = 1, zero = TRUE)
pdweibull(x, q = exp(-1), beta = 1, zero = TRUE)
qdweibull(p, q = exp(-1), beta = 1, zero = TRUE)
rdweibull(n, q = exp(-1), beta = 1, zero = TRUE)

Value

ddweibull gives the density, pdweibull gives the distribution function, qdweibull gives the quantile function, and rdweibull generates random values.

Arguments

x

vector of quantiles.

p

vector of probabilities.

q, beta

shape and scale parameters, the latter defaulting to 1.

zero

logical; if TRUE (default), the support contains \(0\); FALSE otherwise.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

Author

Reza Mohammadi a.mohammadi@uva.nl, Pariya Behrouzi, Veronica Vinciotti

Details

The discrete Weibull distribution has density given by $$ f(x) = q^{x^\beta} - q^{(x+1)^\beta}, x = 0, 1, 2, \ldots $$ For the case zero = FALSE: $$ f(x) = q^{(x-1)^\beta} - q^{x^\beta}, x = 1, 2, \ldots $$

Cumulative distribution function $$ F(x) = 1-q^{(x+1)^\beta} $$ For the case zero = FALSE, x+1 should replaced by x.

References

Nakagawa, T. and Osaki, S. (1975). The Discrete Weibull Distribution. IEEE Transactions on Reliability, R-24, 300-301, tools:::Rd_expr_doi("10.1109/TR.1975.5214915")

See Also

dweibull, bdw.reg, bdgraph.dw

Examples

Run this code
n    = 1000
q    = 0.4
beta = 0.8

set.seed(7)

rdw = rdweibull(n = n, q = q, beta = beta)

plot(prop.table(table(rdw)), type = "h", col = "gray50")

x = 0:max(rdw)

lines(x, ddweibull(x = x, q = q, beta = beta), type = "o", col = "blue", lwd = 2)

hist(pdweibull(x = rdw, q = q, beta = beta))

plot(ecdf(rdw))
lines(x, pdweibull(x, q = q, beta = beta), col = "blue", lwd = 2, type = "s")

Run the code above in your browser using DataLab